﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work6
{
    class Book
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public double _price;

        public double Price
        {
            get
            {
                return _price;
            }
            set
            {
                _price = value;
            }
        }

        // 2. 在类中添加一个给属性赋值的方法
        public void SetBookInfo(int id,string name,double price)
        {
            Id = id;
            Name = name;
            Price = price;
        }



        public void PrintBookInfo()
        {                                                                     //this资格可删除
            Console.WriteLine("图书编号为:{0} 图书名称为:{1} 图书价格为:{2}",this.Id,this.Name,this.Price);

        }

        

    }
}
